home *** CD-ROM | disk | FTP | other *** search
/ Developer CD Series 1994 November: Tool Chest / Dev.CD Nov 94.toast / Tool Chest / !Interfaces / Universal Interfaces 2.0a1 / PInterfaces / Dictionary.p < prev    next >
Encoding:
Text File  |  1994-07-17  |  4.0 KB  |  141 lines  |  [TEXT/MPS ]

  1. {
  2.      File:        Dictionary.p
  3.  
  4.      Copyright:    © 1984-1994 by Apple Computer, Inc.
  5.                  All rights reserved.
  6.  
  7.      Version:    Universal Interfaces 2.0a1.  ETO #15, MPW prerelease.  Sunday, July 17, 1994. 
  8.  
  9.      Bugs?:        If you find a problem with this file, send the file and version
  10.                  information (from above) and the problem description to:
  11.  
  12.                      Internet:    apple.bugs@applelink.apple.com
  13.                      AppleLink:    APPLE.BUGS
  14.  
  15. }
  16.  
  17. {$IFC UNDEFINED UsingIncludes}
  18. {$SETC UsingIncludes := 0}
  19. {$ENDC}
  20.  
  21. {$IFC NOT UsingIncludes}
  22.  UNIT Dictionary;
  23.  INTERFACE
  24. {$ENDC}
  25.  
  26. {$IFC UNDEFINED __DICTIONARY__}
  27. {$SETC __DICTIONARY__ := 1}
  28.  
  29. {$I+}
  30. {$SETC DictionaryIncludes := UsingIncludes}
  31. {$SETC UsingIncludes := 1}
  32.  
  33.  
  34. {$IFC UNDEFINED __TYPES__}
  35. {$I Types.p}
  36. {$ENDC}
  37. {    ConditionalMacros.p                                            }
  38.  
  39. {$IFC UNDEFINED __FILES__}
  40. {$I Files.p}
  41. {$ENDC}
  42. {    MixedMode.p                                                    }
  43. {    OSUtils.p                                                    }
  44.  
  45. {$PUSH}
  46. {$ALIGN MAC68K}
  47. {$LibExport+}
  48.  
  49. CONST
  50. { Dictionary data insertion modes }
  51.     kInsert                        = 0;                            { Only insert the input entry if there is nothing in the dictionary that matches the key. }
  52.     kReplace                    = 1;                            { Only replace the entries which match the key with the input entry. }
  53.     kInsertOrReplace            = 2;                            { Insert the entry if there is nothing in the dictionary which matches the key. 
  54.                            If there is already matched entries, replace the existing matched entries with the input entry. }
  55.  
  56. { This Was InsertMode }
  57.     
  58. TYPE
  59. DictionaryDataInsertMode = INTEGER;
  60.  
  61.  
  62. CONST
  63. { Key attribute constants }
  64.     kIsCaseSensitive            = $10;                            { case sensitive = 16        }
  65.     kIsNotDiacriticalSensitive    = $20;                            { diac not sensitive = 32    }
  66.  
  67. { Registered attribute type constants.    }
  68.     kNoun                        = -1;
  69.     kVerb                        = -2;
  70.     kAdjective                    = -3;
  71.     kAdverb                        = -4;
  72.  
  73. { This Was AttributeType }
  74.     
  75. TYPE
  76. DictionaryEntryAttribute = SInt8;
  77.  
  78. { Dictionary information record }
  79.     DictionaryInformation = RECORD
  80.         dictionaryFSSpec:        FSSpec;
  81.         numberOfRecords:        LONGINT;
  82.         currentGarbageSize:        LONGINT;
  83.         script:                    ScriptCode;
  84.         maximumKeyLength:        INTEGER;
  85.         keyAttributes:            SInt8;
  86.     END;
  87.     DictionaryAttributeTable = PACKED RECORD
  88.         datSize:                UInt8;
  89.         datTable:                PACKED ARRAY [0..0] OF DictionaryEntryAttribute;
  90.     END;
  91.     DictionaryAttributeTablePtr = ^DictionaryAttributeTable;
  92.  
  93.  
  94. FUNCTION InitializeDictionary(theFsspecPtr: FSSpec; maximumKeyLength: INTEGER; keyAttributes: ByteParameter; script: ScriptCode): OSErr;
  95.     {$IFC NOT GENERATINGCFM}
  96.     INLINE $303C, $0500, $AA53;
  97.     {$ENDC}
  98. FUNCTION OpenDictionary(theFsspecPtr: FSSpec; accessPermission: ByteParameter; VAR dictionaryReference: LONGINT): OSErr;
  99.     {$IFC NOT GENERATINGCFM}
  100.     INLINE $303C, $0501, $AA53;
  101.     {$ENDC}
  102. FUNCTION CloseDictionary(dictionaryReference: LONGINT): OSErr;
  103.     {$IFC NOT GENERATINGCFM}
  104.     INLINE $303C, $0202, $AA53;
  105.     {$ENDC}
  106. FUNCTION InsertRecordToDictionary(dictionaryReference: LONGINT; key: ConstStr255Param; recordDataHandle: Handle; whichMode: DictionaryDataInsertMode): OSErr;
  107.     {$IFC NOT GENERATINGCFM}
  108.     INLINE $303C, $0703, $AA53;
  109.     {$ENDC}
  110. FUNCTION DeleteRecordFromDictionary(dictionaryReference: LONGINT; key: ConstStr255Param): OSErr;
  111.     {$IFC NOT GENERATINGCFM}
  112.     INLINE $303C, $0404, $AA53;
  113.     {$ENDC}
  114. FUNCTION FindRecordInDictionary(dictionaryReference: LONGINT; key: ConstStr255Param; requestedAttributeTablePointer: DictionaryAttributeTablePtr; recordDataHandle: Handle): OSErr;
  115.     {$IFC NOT GENERATINGCFM}
  116.     INLINE $303C, $0805, $AA53;
  117.     {$ENDC}
  118. FUNCTION FindRecordByIndexInDictionary(dictionaryReference: LONGINT; recordIndex: LONGINT; requestedAttributeTablePointer: DictionaryAttributeTablePtr; VAR recordKey: Str255; recordDataHandle: Handle): OSErr;
  119.     {$IFC NOT GENERATINGCFM}
  120.     INLINE $303C, $0A06, $AA53;
  121.     {$ENDC}
  122. FUNCTION GetDictionaryInformation(dictionaryReference: LONGINT; VAR theDictionaryInformation: DictionaryInformation): OSErr;
  123.     {$IFC NOT GENERATINGCFM}
  124.     INLINE $303C, $0407, $AA53;
  125.     {$ENDC}
  126. FUNCTION CompactDictionary(dictionaryReference: LONGINT): OSErr;
  127.     {$IFC NOT GENERATINGCFM}
  128.     INLINE $303C, $0208, $AA53;
  129.     {$ENDC}
  130.  
  131. {$ALIGN RESET}
  132. {$POP}
  133.  
  134. {$SETC UsingIncludes := DictionaryIncludes}
  135.  
  136. {$ENDC} {__DICTIONARY__}
  137.  
  138. {$IFC NOT UsingIncludes}
  139.  END.
  140. {$ENDC}
  141.